import java.util.Scanner;

public class MUL {
	public static final int MAX_INPUT_LENGTH = 100000;

	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);

		// Enter number of testcases
		int testcase = in.nextInt();
		while (testcase-- > 0) {
			String firstMultiplier = in.next();
			String secondMultiplier = in.next();

			// store the first numbers in an array
			int[] firstNum = NumberArray(firstMultiplier, firstMultiplier.length());

			// store the second numbers in an array
			int[] secondNum = NumberArray(secondMultiplier, secondMultiplier.length());

			int[] result = handMultiply(firstNum, secondNum);
			display(result);
		}
	}

	private static void display(int[] result) {
		int i = 0;
		for (; (i < result.length) && (result[i] == 0); i++)
			;
		if (i == (result.length) && (result[i - 1] == 0)) {
			System.out.println(0);
		}
		for (; (i < result.length); i++)
			System.out.print(result[i]);
		System.out.println();
	}

	private static int[] NumberArray(String num, int numSize) {
		int[] numberArray = new int[numSize];
		for (int i = (numberArray.length - 1); i >= 0; i--) {
			numberArray[i] = Character.digit(num.charAt(i), 10);
		}
		return numberArray;
	}

	private static int[] handMultiply(int[] firstNum, int[] secondNum) {
		int multipleResult[] = new int[MAX_INPUT_LENGTH];
		int count = 0;
		for (int i = (secondNum.length - 1); i >= 0; i--) {
			int index = (MAX_INPUT_LENGTH - 1 - count);
			int shift = 0;
			for (int j = (firstNum.length - 1); j >= 0; j--) {
				int multiplyRes = (firstNum[j] * secondNum[i]);
				if (multiplyRes > 9) {
					multipleResult[index - 1 - shift] += (multiplyRes / 10);
				}
				multipleResult[index - shift] += (multiplyRes % 10);
				if (multipleResult[index - shift] > 9) {
					multipleResult[index - 1 - shift] += (multipleResult[index
							- shift] / 10);
					multipleResult[index - shift] %= 10;
				}
				shift++;
			}
			count++;
		}
		return multipleResult;
	}
}